import Vue from "vue";
import VueRouter from "vue-router";


Vue.use(VueRouter);

const routes = [
  {
    path: "/reg",
    name: "reg",
    component: ()=> import('../views/Reg'),
    meta:{
      title:"注册页"
    }
  },
  {
    path: "/login",
    name: "login",
    component: ()=> import('../views/Login'),
    meta:{
      title:"登录页"
    }
  },
  {
    path: "/",
    redirect : '/home'// 重定向
  },
  {
    path: "/home",
    name: "home",
    component: ()=> import('../views/Layout'),
    meta:{
      title:"主页"
    },
    children:[
      {
        path: "page",
        name: "page",
        component: ()=> import('../components/Page'),
        meta:{
          title:"首页"
        }
      },
      {
        path: "/home",
       redirect:"/home/page"
        
      },
    
      {
        path: "user",
        name: "user",
        component: ()=> import('../components/User'),
        meta:{
          title:"用户管理"
        }
      },
      {
        path: "goods",
        name: "goods",
        component: ()=> import('../components/Goods'),
        meta:{
          title:"商品管理"
        }
      },
      {
        path: "order",
        name: "order",
        component: ()=> import('../components/Order'),
        meta:{
          title:"定单管理"
        }
      }
    ]
  },

];

const router = new VueRouter({
  routes
});

export default router;
